home *** CD-ROM | disk | FTP | other *** search
- Path: morse.ukonline.co.uk!usenet
- From: g.tafuro@ukonline.co.uk
- Newsgroups: comp.lang.c++
- Subject: Re: C++ template
- Date: 20 Mar 1996 17:35:24 GMT
- Organization: UK Online
- Message-ID: <4ipfks$7om@morse.ukonline.co.uk>
- References: <4in2p7$27b@calvin.st-and.ac.uk>
- NNTP-Posting-Host: wwwproxy.ukonline.co.uk
-
- Usually all the code related a templated class has to be in a header file
- (.Hxx).
- The reason is that the compiler has to substitute the formal parameter (<T>)
- with the actual object.
-
- I suggest you to put all the code (related to the class) in just one header
- file.
- The code seems to be OK. If you accept an other advice, you should provide
- to your class the following operations:
-
- - a virtual destructor;
- - a copy constructor;
- - a virtual assignment operator.
-
- The destructor is important because, if properly built, cleans up the memory
- avoiding memory leaking.
- The other operations are important because most compilers will create them
- even if you do not declare them.
- If you do not like that the users can use the copy constructor or the assignment
- operator, you should make them private.
-
- Hope this helps.
-
- Gabriele Tafuro
- g.tafuro@ukonline.co.uk
-